package ;

import easelhx.display.Bitmap;
import easelhx.display.Graphics;
import easelhx.display.Shape;
import easelhx.js.Image;
import easelhx.display.Stage;
import easelhx.utils.Ticker;
import js.HTMLCanvasElement;
import js.Lib;

/**
 * ...
 * @author 
 */

class BitmapURITestExample implements IExample
{
	private var canvas:HTMLCanvasElement;
	private var stage:Stage;
	private var img:Image;
	private var bmp:Bitmap;

	public function new() 
	{
		canvas = cast Lib.document.getElementById("testCanvas");
		stage =  new Stage(canvas);
	}
	
	/* INTERFACE IExample */
	
	public function run():Void 
	{
		// Bitmap also supports construction with a URI to an image to load:
		bmp = new Bitmap("assets/daisy.png");
		stage.addChild(bmp);

		// we want to do some work before we update the canvas,
		// otherwise we could use Ticker.addListener(stage);
		Ticker.addListener(stage);
		//Ticker.addListener(this);
	}
	
	private function tick(e):Void 
	{
		stage.update();
	}
	
}